#pragma once

#include <string>


/// Tries to parse command line argumets.
class ArgsParser
{
public:
	/// Creates parser for given arguments
	/// In case of error throws std::exception
	ArgsParser(int argc, const char *argv[]);
	
	/// Returns count of connections, that should be created.
	size_t GetConnectionCount() const { return _connectionCount; }

	/// Returns name of server for benchmarking.
	const std::string &GetHostName() const { return _hostName; }

	/// Returns server's incoming port number
	unsigned short getPort() const { return _port; }

	/// Returns true, if synchronious model should be used.
	bool IsSync() const { return _isSync; }

	/// Returns true, if ping-pong client should be started.
	bool IsPingPongClient() const { return _isPingPongClient; }

	/// Returns true, if ping-pong server should work only (without benchmarking).
	bool IsPingPongServer() const { return _isPingPongServer; }

private:
	/// Prints usage help
	inline void PrintHelp();

	/// Sets default settings.
	inline void SetDefault();

	size_t _connectionCount;
	std::string _hostName;
	bool _isSync;
	bool _isPingPongServer;
	bool _isPingPongClient;
	unsigned short _port;
};
